package com.gjs.user.controller;

import cn.hutool.core.bean.BeanUtil;
import com.gjs.common.manager.response.RspBody;
import com.gjs.common.pojo.dto.user.UserInfoDTO;
import com.gjs.user.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@Api(tags = "用户接口")
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {

    private final IUserService userService;

    @GetMapping("/get_user_info")
    @ApiOperation("获取用户信息")
    public RspBody<UserInfoDTO> getUserInfo() {
        return RspBody.success(BeanUtil.copyProperties(userService.getUserBySecurity(), UserInfoDTO.class));
    }
}
